package com.example.springboot3demo.util;

import com.example.springboot3demo.service.SPIServiceI;

import java.util.Iterator;
import java.util.ServiceLoader;

public class SPIServiceTest {

    public static void main(String[] args) {
        ServiceLoader<SPIServiceI> spi = ServiceLoader.load(SPIServiceI.class);
        Iterator<SPIServiceI> iterator =  spi.iterator();
        while (iterator.hasNext()) {
            SPIServiceI spiServiceI = iterator.next();
            spiServiceI.run("开始");
        }

        for (SPIServiceI serviceI : spi) {
            serviceI.run("这个");
        }

    }



}
